package cn.jslancer.config;

import cn.jslancer.spider.ArticlePipeline;
import cn.jslancer.spider.ArticleSpider;
import cn.jslancer.spider.Scheduler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author jslancer
 * @date 2017/11/6
 */
@Configuration
public class SpiderConfig {

    @Autowired
    private ArticleSpider articleSpider;

    @Autowired
    private ArticlePipeline articlePipeline;

    @Bean
    public Scheduler scheduler() {
       Scheduler scheduler = new Scheduler();
       scheduler.setSpider(articleSpider);
       scheduler.addPipeline(articlePipeline);
       return scheduler;
    }
}
